<template>
  <el-scrollbar :native="false" style="height: 100%">
    <div class="title">
      <h1>{{userName}},欢迎使用用户角色管理系统</h1>
      <h1><el-row>本次登录时间：{{nowTime}}</el-row></h1>
    </div>

  </el-scrollbar>
</template>

<script>
  import jwtDecode from "_jwt-decode@3.1.2@jwt-decode";

  export default {
    name: 'Dashboard',
    data(){
      return{
        userName:'',
        nowTime:localStorage.getItem('loginTime')
      }
    },
    created () {
      this.getUserName()
    },
    methods:{
      getUserName(){
        const token = window.localStorage.getItem('authorization')
        const code = jwtDecode(token)
        this.userName = code.user_name
      }
    }
  }
</script>

<style scoped lang="scss">
  div {
    animation: leftMoveIn .7s ease-in;
  }

  @keyframes leftMoveIn {
    0% {
      transform: translateX(-100%);
      opacity: 0;
    }
    100% {
      transform: translateX(0%);
      opacity: 1;
    }
  }

  .title {
    text-align: center;
    font-size: 25px;
  }


  p {
    text-indent: 2em;
  }

  a {
    text-decoration: none
  }
</style>
